package com.yidu.mapper;

import com.yidu.entity.Users;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface UsersMapper {
    @Select("select * from (select rownum as rn,u.* from users u ) where 1=1  and rn between #{page} and #{limit}")
    public List<Users> selectUsers(Map map);
    @Insert("insert into users values (#{usersId},#{usersName},#{usersPassword},#{userRoleId},#{usersFlag})")
    public void insertUsers(Users users);
    @Update("update users set usersName = #{usersName},usersPassword = #{usersPassword},userRoleId = #{userRoleId},usersFlag = #{usersFlag} where usersId = #{usersId}")
    public void updateUsers(Users users);
    @Delete("delete from users where usersId = #{usersId}")
    public void deleteUsers(int usersId);
    @Select("select * from users where usersName = #{param1} and usersPassword = f_encode_pwd(#{param2})")
    public Users selectUser(String usersName , String usersPassword);
}
